/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ep.m002.bl;

import ep.persistence.controllers.T005PatientJpaController;
import ep.persistence.entities.T005Patient;
import java.util.List;
import javax.persistence.Query;

/**
 *
 * @author skyr
 */
public class BL002Controller {

    public T005Patient getPatientByAmka(String amka) {
        T005PatientJpaController jpaController = new T005PatientJpaController();
        Query query = jpaController.getEntityManager().createNamedQuery("T005Patient.findByAmka", T005Patient.class);
        query.setParameter("amka", amka);
        List result = query.getResultList();
        if (!result.isEmpty()) {
            return (T005Patient) query.getResultList().iterator().next();
        }else{
            return null;
        }
    }
}
